#include "TestThread.h"
#include <QDebug>
#include "../src/MyTpThread.h"
#include <QThread>
// #include "Thread.h"
TestThread::TestThread(QCoreApplication * app){
    QThread* thread1=new QThread();
    MyTpThread *tp1;
    tp1=new MyTpThread();
    tp1->moveToThread(thread1);
    // Thread *thread_class=new Thread();
    connect(thread1,SIGNAL(started()),tp1,SLOT(started()));
    connect(app,SIGNAL(aboutToQuit()),tp1,SLOT(deleteLater()));
    connect(thread1,SIGNAL(destroyed()),thread1,SLOT(quit()));
    connect(thread1,SIGNAL(finished()),thread1,SLOT(deleteLater()));
    thread1->start();
    
    // // connect(this,&TestThread::ToThread,tp1,&MyTpThread::run);
    // // connect(this,&TestThread::ToThread,thread_class,&Thread::run);
    
    // // thread_class->moveToThread(thread1);
    // QObject::connect(thread1, SIGNAL(finished()), app, SLOT(quit()));
    // thread1->start();
    // qDebug()<<"connect";
    // emit ToThread();
}